/**  
 * All rights Reserved, Designed By www.woniuxy.com
 * @Title:  Account.java   
 * @Package com.woniu.domain   
 * @Description:    Description  
 * @author: 蜗牛学院  
 * @date:   2019年10月11日 下午8:24:35
 * @user:   Administrator  
 * @version V1.0 
 * @Copyright: 2019 www.woniuxy.com Inc. All rights reserved. 
 * 注意：本内容仅限于成都蜗牛创想科技有限公司，禁止外泄以及用于其他的商业目
 */
package com.woniu.utils;

import java.util.List;

/**
 * @author Administrator
 *
 */
public class PageUtil {
	// private static final long serialVersionUID = -1202716581589799959L;

	private int count;
	private int pageCount;
	private int pageSize;
	private int pageNum;
	private int startNum;
	private int lastPage;
	private int nextPage;
	private List<?> list;

	public PageUtil(int count, int pageNum, List<?> list, int pageSize) {
		super();
		this.count = count;
		this.list = list;
		this.pageNum = pageNum;
		this.pageSize = pageSize;
		if (count % this.getPageSize() == 0) {
			this.pageCount = count / this.getPageSize();
		} else {
			this.pageCount = count / this.getPageSize() + 1;
		}
	}

	public PageUtil() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @return the pageSize
	 */
	public int getPageSize() {
		// this.pageSize=8;
		return pageSize;
	}

	/**
	 * @param pageSize the pageSize to set
	 */
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	/**
	 * @return the pageNum
	 */
	public int getPageNum() {
		return pageNum;
	}

	/**
	 * @param pageNum the pageNum to set
	 */
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	/**
	 * @return the count
	 */
	public int getCount() {
		return count;
	}

	/**
	 * @param count the count to set
	 */
	public void setCount(int count) {
		this.count = count;
	}

	/**
	 * @return the pageCount
	 */
	public int getPageCount() {
		return pageCount;
	}

	/**
	 * @param pageCount the pageCount to set
	 */
	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	/**
	 * @return the startNum
	 */
	public int getStartNum() {
		this.startNum = (this.getPageNum() - 1) * this.getPageSize();
		return startNum;
	}

	/**
	 * @param startNum the startNum to set
	 */
	public void setStartNum(int startNum) {
		this.startNum = startNum;
	}

	/**
	 * @return the lastPage
	 */
	public int getLastPage() {
		if (this.getPageNum() == 1) {
			this.lastPage = this.getPageNum();
		} else {
			this.lastPage = this.getPageNum() - 1;
		}
		return lastPage;
	}

	/**
	 * @param lastPage the lastPage to set
	 */
	public void setLastPage(int lastPage) {
		this.lastPage = lastPage;
	}

	/**
	 * @return the nextPage
	 */
	public int getNextPage() {
		if (this.getPageNum() == this.getPageCount()) {
			this.nextPage = this.getPageCount();
		} else {
			this.nextPage = this.getPageNum() + 1;
		}
		return nextPage;
	}

	/**
	 * @param nextPage the nextPage to set
	 */
	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}

	/**
	 * @return the list
	 */
	public List<?> getList() {
		return list;
	}

	/**
	 * @param list the list to set
	 */
	public void setList(List<?> list) {
		this.list = list;
	}

}
